import React,{useState } from 'react';
// import { userState } from 'react';
const App = () => {
  // 状态数据—— state = (count:0)
  let result = useState (0)
  // console.log(result)  //创建一个状态变量。附赠该变量的修改方法
  let count = result[0]
  let setCount = result[1]

  // 状态数据
  let result2 = useState('Tom')
  console.log(result2)  //['Tom',f]
  let uname = result2[0]
  let setUname = result2[1]

  function doClick() {
    // 修改状态变量
    // count = count + 1
    // console.log(count)
    setCount(count+1)
  }
  return (
    <div>
      <button onClick={doClick}>当前点击了{count}次</button>
    </div>
  );
}

export default App;
